﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbHyperlinkCollection : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbHyperlinkCollection(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbHyperlinkCollection_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbHyperlinkCollection obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbHyperlinkCollection()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbHyperlinkCollection(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbHyperlinkCollection cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbHyperlinkCollection_cast(OdRxObject.getCPtr(pObj));
			OdDbHyperlinkCollection result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbHyperlinkCollection)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbHyperlinkCollection)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbHyperlinkCollection)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbHyperlinkCollection_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbHyperlinkCollection_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbHyperlinkCollection_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdDbHyperlinkCollection createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbHyperlinkCollection_createObject();
			OdDbHyperlinkCollection result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbHyperlinkCollection)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbHyperlinkCollection)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbHyperlinkCollection)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void addHead(string name, string description, string subLocation)
		{
			TD_DbPINVOKE.OdDbHyperlinkCollection_addHead__SWIG_0(this.swigCPtr, name, description, subLocation);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void addHead(string name, string description)
		{
			TD_DbPINVOKE.OdDbHyperlinkCollection_addHead__SWIG_1(this.swigCPtr, name, description);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void addTail(string name, string description, string subLocation)
		{
			TD_DbPINVOKE.OdDbHyperlinkCollection_addTail__SWIG_0(this.swigCPtr, name, description, subLocation);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void addTail(string name, string description)
		{
			TD_DbPINVOKE.OdDbHyperlinkCollection_addTail__SWIG_1(this.swigCPtr, name, description);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void addAt(int hyperlinkIndex, string name, string description, string subLocation)
		{
			TD_DbPINVOKE.OdDbHyperlinkCollection_addAt__SWIG_0(this.swigCPtr, hyperlinkIndex, name, description, subLocation);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void addAt(int hyperlinkIndex, string name, string description)
		{
			TD_DbPINVOKE.OdDbHyperlinkCollection_addAt__SWIG_1(this.swigCPtr, hyperlinkIndex, name, description);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeHead()
		{
			TD_DbPINVOKE.OdDbHyperlinkCollection_removeHead(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeTail()
		{
			TD_DbPINVOKE.OdDbHyperlinkCollection_removeTail(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeAt(int hyperlinkIndex)
		{
			TD_DbPINVOKE.OdDbHyperlinkCollection_removeAt(this.swigCPtr, hyperlinkIndex);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual int count()
		{
			int result = TD_DbPINVOKE.OdDbHyperlinkCollection_count(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdDbHyperlink item(int hyperlinkIndex)
		{
			IntPtr intPtr = TD_DbPINVOKE.OdDbHyperlinkCollection_item(this.swigCPtr, hyperlinkIndex);
			OdDbHyperlink result = (intPtr == IntPtr.Zero) ? null : new OdDbHyperlink(intPtr, false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
